﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data;
using HF.WorkFlow.DataContract;
using HF.Business.Common;
using HF.WorkFlow.DataContract.WorkFlow;

namespace HF.WCF.WFInterface
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“IService1”。
    [ServiceContract]
    public interface IWorkFlowService
    {
        /// <summary>
        /// 启动流程
        /// </summary>
        /// <param name="userId">当前userId</param>
        /// <param name="workFlowId">流程模板Id</param>
        /// <param name="workTaskId">任务模板Id</param>
        /// <param name="commandName">命令名</param>
        /// <param name="workFlowNo">流程编号</param>
        /// <param name="workFlowInsCaption">流程实例名称</param>
        /// <param name="isDraft">是否草稿</param>
        /// <returns>执行结果</returns>
        [OperationContract]
        string Start(string userId, string workFlowId, string workTaskId,
                            string workFlowInstanceId, string workTaskInstanceId, string workflowno, string command, string priority, string workflowInsCaption, bool isDraft);
        /// <summary>
        /// 运行流程
        /// </summary>
        /// <param name="userId">当前用户Id</param>
        /// <param name="operatorInsId">实例Id</param>
        /// <param name="commandName">命令名</param>
        /// <returns>执行结果</returns>
        [OperationContract]
        string Run(string userId, string operatorInsId, string commandName);
        [OperationContract]
        /// <summary>
        /// 获取可以启动的流程
        /// </summary>
        /// <param name="FatherClassId">UserId</param>
        /// <returns>可启动的流程Entitys</returns>
        List<WorkTaskViewEntity> GetAllowsStartWorkFlowEntitys(string userId);

        /// <summary>
        /// 设定流程实例挂起
        /// </summary>
        /// <param name="workFlowInstanceId">流程实例Id</param>
        /// <returns>操作返回码</returns>
        [OperationContract]
        string SetSuspend(string workflowInsId);//流程挂起
        /// <summary>
        /// 设定流程实例取消挂起
        /// </summary>
        ///  <param name="workFlowInstanceId">流程实例Id</param>
        /// <returns>操作返回码</returns>
        [OperationContract]
        string SetResume(string workflowInsId);//取消挂起
        /// <summary>
        /// 设定流程实例异常终止
        /// </summary>
        ///  <param name="workFlowInstanceId">流程实例Id</param>
        ///  <param name="userId">用户IdId</param>
        ///  <param name="msg">异常终止原因</param>
        ///  <returns>操作返回码</returns>
        [OperationContract]
        string SetAbnormal(string workflowInsId, string userId, string msg);//异常终止

        /// <summary>
        /// 待办任务，包括新任务和已认领任务，支持分页
        /// </summary>
        /// <param name="userId">UserId</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>返回待办任务列表Json</returns>
        [OperationContract]
        string GetToDoWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 待办任务，包括新任务和已认领任务，支持分页
        /// </summary>
        /// <param name="userId">UserId</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>返回待办任务列表Entitys</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetTodoWorkTaskEntity(string userId, int pageIndex, int pageSize);

        /// <summary>
        /// 未认领的任务，支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>未认领的任务列表Json</returns>
        [OperationContract]
        string GetClaimWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 未认领的任务，支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>未认领的任务列表Entitys</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetClaimWorkTaskEntity(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 我参与的任务。支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>我参与的任务列表Json</returns>
        [OperationContract]
        string GetAllWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 我参与的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>我参与的任务列表Entitys</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetAllWorkTaskEntity(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 我已认领的任务，支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>我已认领的任务列表Json</returns>
        [OperationContract]
        string GetClaimedWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 我已认领的任务，支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>我已认领的任务列表Entitys</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetClaimedWorkTaskEntity(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 正在运行的流程实例列表，支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>正在运行的流程实例列表Json</returns>
        [OperationContract]
        string GetRunningInstanceJson(int pageIndex, int pageSize);
        /// <summary>
        /// 正在运行的流程实例列表，支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>正在运行的流程实例列表Entitys</returns>
        [OperationContract]
        List<WorkFlowInstanceEntity> GetRunningInstanceEntity(int pageIndex, int pageSize);
        /// <summary>
        /// 已完成的流程实例,支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>已完成的流程实例列表Json</returns>
        [OperationContract]
        string GetCompletedInstanceJson(int pageIndex, int pageSize);
        /// <summary>
        /// 已完成的流程实例,支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>已完成的流程实例列表Entitys</returns>
        [OperationContract]
        List<WorkFlowInstanceEntity> GetCompletedInstanceEntity(int pageIndex, int pageSize);
        /// <summary>
        /// 我已完成的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param> 
        /// <returns>我已完成的任务表Json</returns>
        [OperationContract]
        string GetCompletedWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 我已完成的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param> 
        /// <returns>我已完成的任务表Entitys</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetCompletedWorkTaskEntity(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 异常终止的流程实例，支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>异常终止的任务表Json</returns>
        [OperationContract]
        string GetAbnormalInstanceJson(int pageIndex, int pageSize);
        /// <summary>
        /// 异常终止的流程实例，支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>异常终止的任务表Entitys</returns>
        [OperationContract]
        List<WorkFlowInstanceEntity> GetAbnormalInstanceEntity(int pageIndex, int pageSize);
        /// <summary>
        /// 挂起的流程实例,支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>挂起的任务表Json</returns>
        [OperationContract]
        string GetSuspendInstanceJson(int pageIndex, int pageSize);
        /// <summary>
        /// 挂起的流程实例,支持分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>挂起的任务表Entitys</returns>
        [OperationContract]
        List<WorkFlowInstanceEntity> GetSuspendInstanceEntity(int pageIndex, int pageSize);
        /// <summary>
        /// 异常终止的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>异常终止的任务表Json</returns>
        [OperationContract]
        string GetAbnormalWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 异常终止的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>异常终止的任务表Entitys</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetAbnormalWorkTaskEntity(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 挂起的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>挂起的任务表Json</returns>
        [OperationContract]
        string GetSuspendWorkTaskJson(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 挂起的任务,支持分页
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>挂起的任务表Json</returns>
        [OperationContract]
        List<WorkTaskInstanceViewEntity> GetSuspendWorkTaskEntity(string userId, int pageIndex, int pageSize);
        /// <summary>
        /// 未认领任务的个数
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>数量</returns>
        [OperationContract]
        int GetClaimTaskCount(string userId);
        /// <summary>
        /// 待办任务数量
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>数量</returns>
        [OperationContract]
        int GetToDoTasksCount(string userId);
        /// <summary>
        /// 已认领任务个数
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>数量</returns>
        [OperationContract]
        int GetClaimedTaskCount(string userId);
        /// <summary>
        /// 我参与的任务个数
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>数量</returns>
        [OperationContract]
        int GetAllTaskCount(string userId);
        /// <summary>
        /// 我完成的任务个数
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>数量</returns>
        [OperationContract]
        int GetCompletedTaskCount(string userId);
        /// <summary>
        /// 我异常终止的任务
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>数量</returns>
        [OperationContract]
        int GetAbnormalTaskCount(string userId);
        /// <summary>
        /// 获得流程流水号，每获取一次自动加1。
        /// </summary>
        [OperationContract]
        string GetWorkFlowNO();
        /// <summary>
        /// 获得系统时间
        /// </summary>
        /// <returns>格式如2011-10-11 10:10:11</returns>
        [OperationContract]
        string GetDBDateTime();
        /// <summary>
        /// 获取系统运行日志
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<LogEntity> GetLogEntitys(DateTime startTime, DateTime endTime);
        /// <summary>
        /// 获取流程实体
        /// </summary>
        /// <param name="workFlowId"></param>
        /// <returns></returns>
        [OperationContract]
        WorkFlowEntity GetWorkFlowEntity(string workFlowId);
        /// <summary>
        /// 获得任务节点与表单的视图信息     //zhuyun 20120209
        /// </summary>
        /// <param name="workTaskId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkTaskFormsView(string workTaskId);
        /// <summary>
        /// 获得任务节点的所有命令         //zhuyun 20120209
        /// </summary>
        /// <param name="WorktaskId">任务模板Id</param>
        /// <returns>DataTable</returns>
        [OperationContract]
        DataTable GetTaskCommands(string WorktaskId);
        /// <summary>
        /// 获取可以启动的流程
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>Datable</returns>
        [OperationContract]
        DataTable GetAllowsStartWorkFlows(string userId);
        /// <summary>
        /// 获取流程
        /// </summary>
        /// <param name="operatorInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetOperatorInstanceView(string operatorInstanceId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="workTaskId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetTaskPowers(string workTaskId);
        /// <summary>
        /// 任务退回，退回到前一节点的已认领任务中，需要根据流程业务开发该权限。
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="operatorInstanceId">操作实例Id</param>
        /// <returns>操作返回码</returns> 
        [OperationContract]
        string TaskBack(string userId, string operatorInstanceId);
        /// <summary>
        /// 放弃认领
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="operatorInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string TaskUnClaim(string userId, string operatorInstanceId);
        /// <summary>
        /// 认领任务，认领才能处理
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="operatorInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string TaskClaim(string userId, string operatorInstanceId);
        /// <summary>
        /// 获得流程实例的审批列表 
        /// </summary>
        /// <param name="workflowInsId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetAuditMsgTableByFlow(string workflowInsId);
        /// <summary>
        /// 获得操作实例审批列表
        /// </summary>
        /// <param name="operatorInsId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetAuditMsgTableByOper(string operatorInsId);
        /// <summary>
        /// 插入审批信息
        /// </summary>
        /// <param name="entity"></param>
        [OperationContract]
        void InsertAuditMessage(AuditMessage entity);
        /// <summary>
        ///  更新审批信息
        /// </summary>
        /// <param name="entity"></param>
        [OperationContract]
        void UpdateAuditMessage(AuditMessage entity);
        /// <summary>
        /// 获取流程模板所有节点 
        /// </summary>
        /// <param name="workFlowId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkTasks(string workFlowId);
        /// <summary>
        /// 某一任务实际处理者
        /// </summary>
        /// <param name="workFlowInstanceId"></param>
        /// <param name="workTaskId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetTaskInstanceUser(string workFlowInstanceId, string workTaskId);
        /// <summary>
        /// 判断当前任务节点的实例在流程实例中是否已经产生。
        /// 主要是针对控制节点实例的判断。
        /// </summary>
        /// <param name="workTaskId"></param>
        /// <param name="pWorkTaskInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string GetExistsTaskInstance(string workTaskId, string pWorkTaskInstanceId);
        /// <summary>
        /// 判断节点实例是否都完成
        /// </summary>
        /// <param name="workFlowId"></param>
        /// <param name="workFlowInstanceId"></param>
        /// <param name="judgeTaskId"></param>
        /// <param name="taskTypeAndOr"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsPassJudge(string workFlowId, string workFlowInstanceId, string judgeTaskId, string taskTypeAndOr);
        /// <summary>
        /// 判断任务节点是否正在执行
        /// </summary>
        /// <param name="workFlowInstanceId"></param>
        /// <param name="workTaskId"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsCurrentTask(string workFlowInstanceId, string workTaskId);
        /// <summary>
        /// 获取任务处理信息
        /// </summary>
        /// <param name="workTaskId"></param>
        /// <param name="workFlowInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string GetTaskDoneWhoMsg(string workTaskId, string workFlowInstanceId);

        /// <summary>
        /// 获取当前审核信息
        /// </summary>
        /// <param name="workTaskId"></param>
        /// <param name="workFlowInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string GetTaskOperDoneWhoMsg(string workTaskId, string workFlowInstanceId);
      
        /// <summary>
        /// 获得一个任务模板在流程实例中的所有任务实例
        /// </summary>
        /// <param name="workFlowInstanceId"></param>
        /// <param name="workTaskId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetTaskInstance(string workFlowInstanceId, string workTaskId);
        /// <summary>
        /// 获取一条数据记录
        /// </summary>
        /// <param name="workTaskInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkTaskInstanceTable(string workTaskInstanceId);
        /// <summary>
        /// 获取流程的所有任务连线视图
        /// </summary>
        /// <param name="workFlowId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkTaskLineView(string workFlowId);
        /// <summary>
        /// 获取任务交给了谁
        /// </summary>
        /// <param name="workTaskInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string GetTaskToWhoMsg(string workTaskInstanceId);
        /// <summary>
        /// 获得任务成功提交信息
        /// </summary>
        /// <param name="workTaskInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string GetResultMsg(string workTaskInstanceId);
        /// <summary>
        /// 获得任务节点附件列表
        /// </summary>
        /// <param name="workflowInsId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetAffixTable(string workflowInsId,bool satue);
        [OperationContract]
        int DeleteAffix(string affixId);
        /// <summary>
        /// 新建附件
        /// </summary>
        [OperationContract]
        void InsertAffixcrm(AffixFiles entity);
        /// <summary>
        /// 指派任务
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="assignUserId"></param>
        /// <param name="operatorInsId"></param>
        /// <returns></returns>
        [OperationContract]
        string WorkTaskAssign(string userId, string assignUserId, string operatorInsId);
        /// <summary>
        /// 获取自定义表单数据 
        /// </summary>
        /// <param name="formid"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetTableEntity(string formid);
        /// <summary>
        /// 流程监控
        /// </summary>
        /// <param name="workFlowInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkflowdetail(string workFlowInstanceId);

        /// <summary>
        /// 查询流程层级
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable SetHFWorkFlowClass();

        /// <summary>
        /// 流程代理
        /// </summary>
        /// <param name="userid">用户</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetUserAgency(string userid);
        /// <summary>
        /// 流程代理 
        /// </summary>
        /// <param name="userid">部门</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetDeptAgency(string userid);
        /// <summary>
        /// 流程代理添加记录
        /// </summary>
        /// <param name="entity"></param>
        [OperationContract]
        void Insert(WorkAgencyEntity entity);
        /// <summary>
        /// 删除记录 代理
        /// </summary>
        /// <param name="agencyid"></param>
        [OperationContract]
        void Delete(string agencyid);
        /// <summary>
        /// 查找流程代理
        /// </summary>
        /// <param name="agencyid">代理ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkAgencyTable(string agencyid);
        /// <summary>
        /// 退回至申请人
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="operatorInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        string TaskBackApplicant(string userId, string operatorInstanceId);

        /// <summary>
        /// 已授出的权限
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>DataTable</returns>
        [OperationContract]
        DataTable GetToAccreditTable(string userId);

        /// <summary>
        /// 被授予的权限
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns>DataTable</returns>
        [OperationContract]
        DataTable GetHaveAccreditTable(string userId);

        /// <summary>
        /// 获得流程分类的所有子分类列表
        /// </summary>
        /// <param name="classId">分类Id</param>
        /// <returns>子分类table</returns>
        [OperationContract]
        DataTable GetChildClass(string classId);

        /// <summary>
        /// 获得流程分类下的所有流程列表
        /// </summary>
        /// <param name="classId">流程分类Id</param>
        /// <returns>流程列表</returns>
        [OperationContract]
        DataTable GetWorkFlowsByClassId(string classId);

        /// <summary>
        /// 判断用户是否是该任务节点的操作者，如果不是不允许授权该任务.
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="workFlowId">流程模板Id</param>
        /// <param name="workTaskId">任务模板Id</param>
        /// <returns></returns>
        [OperationContract]
        bool IsTaskOperator(string userId, string workFlowId, string workTaskId);

        /// <summary>
        /// 任务授权
        /// </summary>
        /// <param name="fromUserId">授权UserId</param>
        /// <param name="toUserId">被授权UserId</param>
        /// <param name="workflowId">流程模板Id</param>
        /// <param name="worktaskId">任务模板Id</param>
        /// <returns>操作是否成功的代码</returns>
        [OperationContract]
        string AssignAccredit(string fromUserId, string toUserId, string workFlowId, string workTaskId);

        /// <summary>
        /// 删除授权
        /// </summary>
        /// <param name="accreditId">授权Id</param>
        [OperationContract]
        bool RemoveMoveAccredit(string accreditId, bool reults, DateTime AcceditCancelTime);

         /// <summary>
        /// 收回代理(所有)
        /// </summary>
        /// <param name="fromUserId"></param>
        /// <param name="toUserId"></param>
        [OperationContract]
        bool RemoveAccredit(string fromUserId, string toUserId, bool reults, DateTime AcceditCancelTime);
        /// <summary>
        /// 指定人处理
        /// </summary>
        [OperationContract]
        void DeleteByTaskInstance(string workTaskInstanceId);
        /// <summary>
        /// 指定人插入数据
        /// </summary>
        [OperationContract]
        int NextOperInsert(WorkTaskInstanceNextOperEntity entity);
        
        /// <summary>
        /// 已完成的流程分类
        /// </summary>
        [OperationContract]
        DataTable WorkFlowInstanceClass(string url, string satae);

        /// <summary>
        /// 已完成的任务分类
        /// </summary>
        [OperationContract]
        DataTable WorkTaskCompleteClass(string url, string satae);
       
        /// <summary>
        ///我参与的任务分类
        /// </summary>
        [OperationContract]
        DataTable WorkTaskInstanceClass(string url, string satae);
        /// <summary>
        ///我的申请分类
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowApplicationClass(string url, string satae);
        /// <summary>
        ///我的审批分类
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowApproveClass(string url, string satae);
        /// <summary>
        /// 待办任务分类
        /// </summary>
        /// <param name="url"></param>
        /// <param name="satae"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetTaskInstanceClass(string url, string satae);

        /// <summary>
        /// 撤消分类统计
        /// </summary>
        /// <param name="url"></param>
        /// <param name="satae"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWofkFlowInstanceClass(string url, string satae);

        /// <summary>
        /// 删除作废流程
        /// </summary>
        /// <param name="WorkFlowInstanceId">流程ID</param>
        /// <returns></returns>
        [OperationContract]
        bool DelectWofkFlowInstance(string WorkFlowInstanceId);
       
        /// <summary>
        /// 异常流程分类统计
        /// </summary>
        /// <param name="url"></param>
        /// <param name="satae"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowErrorLogsClass(string url, string satae);

        /// <summary>
        /// 统计流程是否阅读
        /// </summary>
        /// <param name="workTaskInstanceId">任务实例ID</param>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        [OperationContract]
        int GetWorkFlowDisplay(string workTaskInstanceId, string userId);
         /// <summary>
        /// 查询异常流程
        /// </summary>
        /// <param name="workTaskInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowErrorLogs(string workTaskInstanceId);
        /// <summary>
        /// 异常流程处理
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        int GetWorkFlowErrorLogsColse(string type, string WorkTaskInstanceId, string WorkFlowInstanceId);
        /// <summary>
        /// 流程信息
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlow();

        /// <summary>
        /// 获得流程的所有任务节点
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkTasksView();

        /// <summary>
        /// 操作者
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable TaskOperator();

        /// <summary>
        /// 处理者信息
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetOpercontent(string userId);
        /// <summary>
        /// 是否锁定当前我申请流程
        /// </summary>
        /// <param name="worktaskid"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsLock(string worktaskid);
        /// <summary>
        ///  获得任务与流程实例视图
        /// </summary>
        /// <param name="workTaskInstanceId"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkTaskInstanceView(string workTaskInstanceId);

        /// <summary>
        /// 撤消状态
        /// </summary>
        /// <param name="WorkFlowInstanceId"></param>
        /// <param name="satae">撤消--6</param>
        /// <returns></returns>
        [OperationContract]
        bool UpdateWofkFlowInstance(string WorkFlowInstanceId, string satae);

        /// <summary>
        /// 获取下一节表单号
        /// </summary>
        /// <param name="PreviousTaskInstanceIde">当然任务实例ID</param>
        /// <param name="workTaskId">任务模板Id</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetNetTaskFormID(string PreviousTaskInstanceIde, string workTaskId);

        /// <summary>
        /// 获取任务实例节点的类型
        /// </summary>
        /// <param name="WorkTaskInstanceId">任务实例节点ID</param>
        /// <returns></returns>
        [OperationContract]
        string GetWorkTaskTypeID(string WorkTaskInstanceId);

        /// <summary>
        /// 获得流程名称
        /// </summary>
        /// <param name="workFlowId">流程Id</param>
        /// <returns></returns>
        [OperationContract]
        string GetWorkFlowCaption(string workFlowId);
        /// <summary>
        /// 更新任务实例状态
        /// </summary>
        /// <param name="workTaskInstanceId"></param>
        [OperationContract]
        void SetWorkTaskInsStatus(string workTaskInstanceId);


        /// <summary>
        /// 添加流程规则
        /// </summary>
        /// <param name="AppSystem">系统</param>
        /// <param name="AppModel">模块</param>
        /// <param name="MethodName">方法名称</param>
        /// <param name="ClassName">参数实体</param>
        /// <param name="Iserver">服务接口</param>
        /// <param name="Address">服务地址</param>
        /// <param name="Parameter">参数</param>
        /// <param name="Staus">流程状态</param>
        /// <returns></returns>
        [OperationContract]
        int AddLoadIserver(string AppSystem, string AppModel, string MethodName, string ClassName, string Iserver, string Address, string Parameter, char Staus, string WorkFlowId, string ObjectFolder, List<ParameterEntity> parameter);

        /// <summary>
        /// 对比流程规则
        /// </summary>
        /// <param name="workFlowInstanceId">流程实例ID</param>
        /// <param name="flowCaption">流程名称</param>
        /// <param name="workFlowId">流程ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable ContrastLoad(string workFlowInstanceId, string flowCaption, string workFlowId);

        /// <summary>
        /// 查询参数方法
        /// </summary>
        /// <param name="appModel">模块</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetParameter(string appModel);
        
       
        /// <summary>
        /// 指流程类型我已完成的任务,支持分页
        /// </summary>
        /// <param name="userId">WorkFlowClassID</param>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param> 
        /// <returns>我已完成的任务表Entitys</returns>
        [OperationContract]
        DataTable GetCompletedWorkTaskByClass(string WorkFlowClassID, string userId, int pageIndex, int pageSize);
   
        /// <summary>
        /// 指定流程类型的待办任务，支持分页
        /// </summary>
        /// <param name="userId">WorkFlowClassID</param>
        /// <param name="userId">UserId</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>返回待办任务列表</returns>
         [OperationContract]
        DataSet GetTodoWorkTaskByClass(string WorkFlowClassID, string userId, int pageIndex, int pageSize);
         /// <summary>
         /// 获取下一流程实例
         /// </summary>
         /// <param name="worktaskinsid"></param>
         /// <returns></returns>
        [OperationContract]
         DataTable GetWorktaskInsStatus(string worktaskinsid);


         /// <summary>
        /// 流程代理新增
        /// </summary>
        /// <param name="entitys">流程代理实例</param>
        /// <returns></returns>
        [OperationContract]
        bool AddAccreditUser(List<AccreditUserEntity> entitys);
        /// <summary>
        /// 查询用户Guid
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        [OperationContract]
        string GetDatUser(string userId);
        
        /// <summary>
        /// 当前操作人代理状况
        /// </summary>
        /// <param name="accreditToUserId">操作人ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetOwnAccreditUser(string accreditToUserId);

        /// <summary>
        /// 其它操作人代理状况
        /// </summary>
        /// <param name="accreditToUserId">操作人ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetOtherAccreditUser(string accreditToUserId);

        /// <summary>
        /// 流程代理查询
        /// </summary>
        /// <param name="url">SQL语句条件</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetAccreditList(string url);
        /// <summary>
        /// 流程代理明细
        /// </summary>
        /// <param name="accreditToUserId">操作人ID</param>
        /// <param name="accreditFromUserId">被操作人ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetAccreditUserList(string accreditToUserId, string accreditFromUserId);
       
        /// <summary>
        /// 流程类型
        /// </summary>
        /// <param name="accreditToUserId">操作人ID</param>
        /// <param name="accreditFromUserId">被操作人ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowCaptions(string accreditToUserId, string accreditFromUserId);
      
        /// <summary>
        /// 流程名称
        /// </summary>
        /// <param name="accreditToUserId">操作人ID</param>
        /// <param name="accreditFromUserId">被操作人ID</param>
        /// <returns></returns>
        [OperationContract]
        DataTable GetInstanceCaption(string accreditToUserId, string accreditFromUserId);


        /// <summary>
        /// 查询所有流程
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowClass();

        /// <summary>
        /// 查询所有流程列表
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataTable GetWorkFlowList();
        
        /// <summary>
        /// 转发回写操作
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="worktaskInsId"></param>
        [OperationContract]
        void SetOperatorInstance(string userId, string worktaskInsId);
        /// <summary>
        /// 更新标题
        /// </summary>
        /// <param name="workFlowInstanceId"></param>
        /// <param name="title"></param>
        [OperationContract]
        void UpdateTitle(string workFlowInstanceId, string title);
        
    }
}
